package com.czl.module_user.fragment

import com.alibaba.android.arouter.facade.annotation.Route
import com.czl.base.base.BaseFragment
import com.czl.base.config.AppConstants
import com.czl.base.data.bean.UserBean
import com.czl.base.event.LiveBusCenter
import com.czl.module_user.BR
import com.czl.module_user.R
import com.czl.module_user.databinding.FragmentUserBinding
import com.czl.module_user.viewmodel.UserViewModel
import com.gyf.immersionbar.ImmersionBar


@Route(path = AppConstants.Router.User.F_USER)
class UserFragment : BaseFragment<FragmentUserBinding, UserViewModel>() {

    private lateinit var areaList: List<UserBean.Data>

    override fun initContentView(): Int {
        return R.layout.fragment_user
    }

    override fun initVariableId(): Int {
        return BR.viewModel
    }

    override fun isImmersionBarEnabled(): Boolean {
        return true
    }

    override fun initStatusBar() {
        ImmersionBar.with(this)
            .fitsSystemWindows(false)
            .statusBarDarkFont(true)
            .init()
    }

    override fun initData() {
        areaList = viewModel.model.getAreaList()
        viewModel.getUserInfo()
        viewModel.getPointDetail()
    }

    override fun initViewObservable() {

        LiveBusCenter.observeModifyUserInfoEvent(this) {
            viewModel.getUserInfo()
        }
    }

    override fun useBaseLayout(): Boolean {
        return false
    }

}